class Revision < ActiveRecord::Base
  has_many :comments
  belongs_to :page
  
  # Shows the human-readable revision number, no
  # idea how it works, but it does.
  def rid
    return 1 if self.page.nil?
    
    revs = self.page.revisions
    rid = 0
    until rid >= revs.length || revs[rid] == self
      rid += 1
    end
    return rid + 1
  end
end
